<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="icon" th:href="@{/img/apple.png}"/>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" crossorigin="anonymous">
    <link rel="stylesheet" th:href="@{/css/global.css}" />
    <title>举报管理</title>
</head>
<body>
<div class="nk-container">
    <!-- 头部 -->
    <header class="bg-dark sticky-top" th:replace="index::header">
        <div class="container">
            <!-- 导航 -->
            <nav class="navbar navbar-expand-lg navbar-dark">
                <!-- logo -->
                <a class="navbar-brand" href="#"></a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <!-- 功能 -->
                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <ul class="navbar-nav mr-auto">
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="../index.html">首页</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link position-relative" href="letter.html">消息<span class="badge badge-danger">12</span></a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="register.html">注册</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical">
                            <a class="nav-link" href="login.html">登录</a>
                        </li>
                        <li class="nav-item ml-3 btn-group-vertical dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                <img src="http://images.nowcoder.com/head/1t.png" class="rounded-circle" style="width:30px;"/>
                            </a>
                            <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                <a class="dropdown-item text-center" href="profile.html">个人主页</a>
                                <a class="dropdown-item text-center" href="setting.html">账号设置</a>
                                <a class="dropdown-item text-center" href="login.html">退出登录</a>
                                <div class="dropdown-divider"></div>
                                <span class="dropdown-item text-center text-secondary">nowcoder</span>
                            </div>
                        </li>
                    </ul>
                    <!-- 搜索 -->
                    <form class="form-inline my-2 my-lg-0" action="search.html">
                        <input class="form-control mr-sm-2" type="search" aria-label="Search" />
                        <button class="btn btn-outline-light my-2 my-sm-0" type="submit">搜索</button>
                    </form>
                </div>
            </nav>
        </div>
    </header>

    <!-- 内容 -->
    <div class="main">
        <div class="container">
            <form class="form-inline" action="" method="get" id="queryForm">
                <label for="targetUser" class="mb-2 mr-sm-2">被举报者：</label>
                <input type="text" class="form-control mb-2 mr-sm-2" th:value="${param.targetUser}"
                       id="targetUser" placeholder="" name="targetUser">

                <label for="username" class="mb-2 mr-sm-2">举报者：</label>
                <input type="text" class="form-control mb-2 mr-sm-2" th:value="${param.username}"
                       id="username" placeholder="" name="username">

                <label for="entityType" class="mb-2 mr-sm-2">类别：</label>
                <select class="form-control mb-2 mr-sm-2"
                        id="entityType" name="entityType">
                    <option value="-1">请选择</option>
                    <option value="1">帖子</option>
                    <option value="3">用户</option>
                </select>

                <label for="status" class="mb-2 mr-sm-2">状态：</label>
                <select class="form-control mb-2 mr-sm-2"
                        id="status" name="status">
                    <option value="-1">请选择</option>
                    <option value="0">未处理</option>
                    <option value="1">已处理</option>
                    <option value="2">已驳回</option>
                </select>

                <button type="reset" class="btn btn-secondary mb-2 ">重置</button>&nbsp;&nbsp;&nbsp;
                <button type="button" id="query" onclick="queryReports()" class="btn btn-primary mb-2 pull-right" >查询</button>
            </form>
            <table class="table table-bordered table-hover">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>被举报类型</th>
                    <th>被举报实体</th>
                    <th>举报内容</th>
                    <th>状态</th>
                    <th>被举报者</th>
                    <th>举报者</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr th:each="map:${result}">
                    <td th:text="${map.report.id}">01</td>
                    <td th:text="${map.report.entityType==1?'帖子':'用户'}">举报类型</td>
                    <td th:text="${map.entity}">被举报实体</td>
                    <td th:text="${map.report.content}">举报内容</td>
                    <td th:text="${map.report.status==0?'未处理':(map.report.status==1?'已处理':'已驳回')}">状态</td>
                    <td th:text="${map.tagUser}">被举报者</td>
                    <td th:text="${map.rpUser}">举报者</td>
                    <td th:text="${#dates.format(map.report.createTime,'yyyy-MM-dd HH:mm:ss')}">创建时间</td>
                    <td>
                        <input type="hidden" th:value="${map.report.id}" th:id="|id${map.report.id}|">
                        <input type="hidden" th:value="${map.report.entityType}" th:id="|entityType${map.report.id}|">
                        <input type="hidden" th:value="${map.report.entityId}" th:id="|entityId${map.report.id}|">
                        <button type="button" th:disabled="${map.report.status==1}" class="btn btn-light btn-xm" id="setId" th:onclick="dispose([[${map.report.id}]])">
                            <span class="glyphicon glyphicon-pencil"></span> 处理
                        </button>
                        <button type="button" th:disabled="${map.report.status==2}" class="btn btn-danger btn-xm" id="delete" th:onclick="reBack([[${map.report.id}]])">
                            <span class="glyphicon glyphicon-trash"></span> 驳回
                        </button>
                    </td>
                </tr>
                </tbody>
            </table>

            <!-- 提示框 -->
            <div class="modal fade" id="hintModal" tabindex="-1" role="dialog" aria-labelledby="hintModalLabel" aria-hidden="true">
                <div class="modal-dialog modal-lg" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="hintModalLabel">提示</h5>
                        </div>
                        <div class="modal-body" id="hintBody">
                            发布完毕!
                        </div>
                    </div>
                </div>
            </div>

            <!-- 分页 -->
            <nav class="mt-5" th:replace="index::pagination">
                <ul class="pagination justify-content-center">
                    <li class="page-item"><a class="page-link" href="#">首页</a></li>
                    <li class="page-item disabled"><a class="page-link" href="#">上一页</a></li>
                    <li class="page-item active"><a class="page-link" href="#">1</a></li>
                    <li class="page-item"><a class="page-link" href="#">2</a></li>
                    <li class="page-item"><a class="page-link" href="#">3</a></li>
                    <li class="page-item"><a class="page-link" href="#">4</a></li>
                    <li class="page-item"><a class="page-link" href="#">5</a></li>
                    <li class="page-item"><a class="page-link" href="#">下一页</a></li>
                    <li class="page-item"><a class="page-link" href="#">末页</a></li>
                </ul>
            </nav>

        </div>
    </div>

    <!-- 尾部 -->

</div>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" crossorigin="anonymous"></script>
<script th:src="@{/js/global.js}"></script>
<script th:src="@{/js/reportList.js}"></script>

</body>
</html>